package com.liruo.learn.spring.security.resphandler;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author:liruo
 * @Date:2023-05-26-19:57:56
 * @Desc
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseResp<T>{
    private T data;
    private int code;
    public static BaseResp<String> fail(String msg, int code){
        return new BaseResp<>(msg, code);
    }

    public static <T> BaseResp<T> ok(T data) {
        return new BaseResp<>(data, 0);
    }
}
